package com.example.logger;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

import com.orhanobut.logger.Logger;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class MainActivity extends Activity {
    private static final String TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Logger.d("hello");

        try {
            InputStream inputStream = getAssets().open("test.json");

            BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));

            String lineStr = "";

            StringBuilder sb = new StringBuilder();

            while ((lineStr = br.readLine()) != null){
                sb.append(lineStr);
            }

            String jsonStr = sb.toString();

            Log.i(TAG, "JSON: "+jsonStr);

            Logger.json(jsonStr);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
